package cn.itcast.demo.web;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Arrays;

/**
 * @author 虎哥
 */
@Controller
public class HelloController {

    /**
     * 返回视图名称：hello \r\n
     * InternalResourceViewResolver
     *  - prefix: /WEB-INF/views/
     *  - suffix: .jsp
     *  视图地址：prefix + viewName + suffix
     */
    @GetMapping("hello")
    public String toHello(Model model){
        model.addAttribute("username", "Tiger Zhang");

        model.addAttribute("girls", Arrays.asList("刘亦菲", "范冰冰", "古力娜扎", "迪丽热巴"));
        return "hello";
    }
}
